<%@ page contentType="text/html; charset=utf-8" language="java" import="java.util.*" %>
<%@ taglib uri="/struts-tags" prefix="s"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>无标题文档</title>
<link href="../style/main.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet"  href="../style/style.css" />
<script type="text/javascript" src="../Scripts/jquery.js"></script>

<script src="<%=basePath%>/Scripts/jquery-1.3.1.js" type="text/javascript"></script>
<script src="<%=basePath%>/Scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
<script src="<%=basePath%>/Scripts/ui.datepicker-zh_CN.js" type="text/javascript"></script>
<link href="<%=basePath%>/style/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />


<style>
body{ padding:10px}
</style>
<script type="text/javascript">

function datePicker(pickerName,locale) {
		$(pickerName).datepicker($.datepicker.regional[locale]);
		$(pickerName).datepicker('option', 'changeMonth', true);//月份可调
		$(pickerName).datepicker('option', 'changeYear', true);//年份可调
		
	}
$(document).ready(function(){
datePicker('#separationDate','zh_CN');
})

function changeDepartment(){
	var departmentList =  document.getElementById("departmentList");
	var departmentId = departmentList.options[departmentList.selectedIndex].value;
	if(departmentId == "")
		return;
	$.post("/WITAgent/Personnel/separationAction!findEmployeeByDepartmentId.action",{"separation.employee.deapartmentId":departmentId},function(data){
	alert(data);
		var employeeList = document.getElementById("employeeList");
		while(employeeList.options.length > 0){
			employeeList.remove(0);
		}
		var op = document.createElement("option");
            op.value = "";
            op.text = "--全部--";
            employeeList.options.add(op);
		for(var i=0;i<data.length;i++){
            op = document.createElement("option");
            op.value = data[i].employeeId;
            op.text = data[i].employeeName;
            employeeList.options.add(op);
        }
	},"json");
}
</script>
</head>

<body><br />
<s:form action="separationAction!modifySeparation" method="post" theme="simple">
  <div class="search">
    <table width="100%" border="0" align="left" cellpadding="0" cellspacing="2" class="table4" >
      <tr>
        <td width="100%" bgcolor="#BBD2F7" class="title">员工离职登记</td>
      </tr>
      <tr>
        <td bgcolor="#ffffff" ><table cellpadding="0" cellspacing="0" width="100%" >
          <tr>
            <th width="102" align="left"> 记录编号：</th>
            <td colspan="2" align="left"><s:textfield name="separation.separationId" cssStyle="width:138px"/></td>
            </tr>
          <tr>
            <th align="left">部门：</th>
            <td colspan="2" align="left"><s:select name="separation.employee.deapartmentId" list="departmentList" listKey="departmentId" listValue="departNameC" headerKey="''" headerValue="--全部--" id="departmentList" onchange="changeDepartment()"  cssStyle="width:150px"/></td>
            </tr>
          <tr>
            <th align="left">员工姓名：</th>
            <td colspan="2" align="left"><s:select list="employeeList" id="employeeList" name="separation.employee.employeeId" listKey="employeeId" listValue="employeeNameC" cssStyle="width:150px"/></td>
            </tr>
          <tr>
            <th align="left">离职时间：</th>
            <td width="412" align="left"><s:textfield name="separation.separationDate" id="separationDate" cssStyle="width:138px"><s:param name="value">
                        <s:date name="separation.separationDate" format="yyyy-MM-dd"/></s:param></s:textfield></td>
            <td width="274" align="left"><s:checkbox name="separation.isSwitch" cssClass="check" fieldValue="true" />是否属于转司</td>
          </tr>
          <tr>
            <td align="left">离职原因：</td>
            <td colspan="2" align="left"><s:textarea name="separation.sepReason" cols="45" rows="5"/></td>
            </tr>
          <tr>
            <td align="left">四联单编号：</td>
            <td colspan="2" align="left"><s:textfield name="separation.forCheck" cssStyle="width:138px"/></td>
          </tr>
        </table></td>
      </tr>
    </table>
    <div class="clear"></div>
    <table width="100%" border="0" align="left" cellpadding="0" cellspacing="2" class="table5">
      <tr>
        <td valign="top" class="fjxx_left"><table width="100%" cellpadding="0" cellspacing="0"class="table3">
          <tr>
            <td align="center" ><s:submit value="保 存"  cssStyle="width:60px; height:20px;"/>
              &nbsp;&nbsp;&nbsp;&nbsp;
              <s:reset value="取 消" cssStyle="width:60px; height:20px;"/></td>
          </tr>
        </table></td>
      </tr>
    </table>
  </div>
</s:form>

</body>
</html>